<template>
	<view class="ckwl">
		<view class=""  v-if="webvi" style="display: block;height: 500rpx;position: relative;">
			<web-view style="height: 500rpx;" :src="webvi"></web-view>
		</view>
		<view class="mt-15 plr-40 ptb-25 bg-fff f-24 c-333" v-if="order_id">
			<view>{{express_name}}</view>
			<view>运单号：{{shipping_code}}</view>
		</view>
		<view  class="mt-15 plr-40 wuliu bg-fff">			
			
			
			<view v-for="(item,index) in dataLis" class="shlist flex0" :key="index">
				<view class="times f-24">
					<!-- {{item.time.split(" ")[0]}} <br/> {{item.time.split(" ")[1]}} -->
					{{item.time}}
				</view>
				<view class="zhuant1 f-18 ">
					<image  src="/static/images/zt1.png" mode=""></image>
				</view>
				<view style="width: 450upx;" class="f-24">
					{{item.context}}
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				state:0,
				address:"",
				shipping_code:"",
				express_name:"",
				isShouh:2,
				order_id:0,
				dataLis:[],
				rec_id:"",
				refund_id:"",
				lid:"",//抽奖ID
				webvi:''
			}
		},
		onLoad(e) {
			if(e.lid){//抽奖实物 物流
				this.lid=e.lid;
				this.draw();
			}
			if(e.return_id){//换货物流
				this.refund_id=e.return_id
				this.gethhwl()
			}
			if(e.order_id && !e.rec_id){//全部订单查看物流
				this.order_id=e.order_id
				this.getData()
			}
			if(e.rec_id&&e.order_id){//自营店铺物流
				this.rec_id=e.rec_id;
				this.order_id=e.order_id
				this.getwliu();
			}
			// if(e.wb_no&&e.express_code){
			// 	this.wb_no=e.wb_no;
			// 	this.express_code=e.express_code;
			// 	this.getInfo()
			// }
			if(e.order_jifen_id&&e.type=='jifen'){
				this.order_id=e.order_jifen_id
				this.getJifenWULIU()
			}
		},
		methods: {
			draw(){//抽奖实物 物流
				this.$util.request({
					url:'/mobile/index.php?act=bigwheel&op=logistics',
					method:'get',
					data:{
						lid:this.lid
					}
				}).then(res=>{
					if(res.error_code==0){
						// this.address=res.datas.adress
						// this.express_name=res.datas.express_name
						// this.shipping_code=res.datas.shipping_code
						// this.state=res.datas.order_info.order_state				
						let arr=res.datas.deliver_info
						for(let i=0;i<arr.length;i++){
							this.dataLis.push(arr[i])
						}
					}else{
						uni.showToast({
							title:res.message,
							icon:"none"
						})
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},1500)
					}
				})	
			},
			gethhwl(){//换货物流
				this.$util.request({
					url:'/mobile/index.php?act=member_exchange&op=search_deliver',
					method:'get',
					data:{
						refund_id:this.refund_id
					}
				}).then(res=>{
					if(res.error_code==0){
						// this.address=res.datas.adress
						// this.express_name=res.datas.express_name
						// this.shipping_code=res.datas.shipping_code
						// this.state=res.datas.order_info.order_state				
						let arr=res.datas.deliver_info
						for(let i=0;i<arr.length;i++){
							this.dataLis.push(arr[i])
						}
					}else{
						uni.showToast({
							title:res.message,
							icon:"none"
						})
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},1500)
					}
				})	
			},// 获取积分物流
			getJifenWULIU(){
				this.$util.request({
					url:'/mobile/index.php?act=member_pointorder&op=search_deliver',
					
					data:{
						order_id:this.order_id
						}
				}).then(res=>{
					if(res.error_code==0){
						if(res.error_code == 4440004){
							uni.showToast({
								title:res.message,
								icon:"none"
							})
							setTimeout(()=>{
								uni.navigateBack({
									delta:1
								})
							},1500)
						}
						this.address=res.datas.adress
						this.express_name=res.datas.express_name
						this.shipping_code=res.datas.shipping_code
						this.state=res.datas.order_info.point_orderstate				
						let arr=res.datas.deliver_info
						for(let i=0;i<arr.length;i++){
							this.dataLis.push(arr[i])
						}
						
					}else{
						uni.showToast({
							title:res.message,
							icon:"none"
						})
					}
				})
			},
			getwliu(){//自营店铺物流
				this.$util.request({
					// url:'/mobile/index.php?act=member_order&op=search_goods_deliver',
					url:'/mobile/index.php?act=member_order&op=search_deliver',
					method:'get',
					data:{
						// rec_id:this.rec_id,
						order_id:this.order_id,
					}
				}).then(res=>{
					if(res.error_code==0){
						this.address=res.datas.adress
						this.express_name=res.datas.express_name
						this.webvi=res.datas.trailUrl
						this.shipping_code=res.datas.shipping_code
						this.state=res.datas.order_info.order_state				
						let arr=res.datas.deliver_info
						for(let i=0;i<arr.length;i++){
							this.dataLis.push(arr[i])
						}
					}else{
						uni.showToast({
							title:res.message,
							icon:"none"
						})
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},1500)
					}
						
					
				})
				
				
			},
			
			
			getData(){//全部订单查看物流
				this.$util.request({
					url:'/mobile/index.php?act=member_order&op=search_deliver',
					method:'get',
					data:{
						order_id:this.order_id,
						// rec_id:this.rec_id
					}
				}).then(res=>{
					if(res.error_code == 4440004){
						uni.showToast({
							title:res.message,
							icon:"none"
						})
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},1500)
					}
					this.address=res.datas.adress
					this.express_name=res.datas.express_name
					this.webvi=res.datas.trailUrl
					this.shipping_code=res.datas.shipping_code
					this.state=res.datas.order_info.order_state				
					let arr=res.datas.deliver_info
					for(let i=0;i<arr.length;i++){
						this.dataLis.push(arr[i])
					}
					
				})
			}
			// getInfo(){//tv订单查看物流
			// 	this.$util.request({
			// 		url:'/mobile/index.php?act=tv_order&op=deliver',
			// 		method:'get',
			// 		data:{
			// 			express_code:this.express_code,
			// 			wb_no:this.wb_no,
			// 		}
			// 	}).then(res=>{
			// 		if(res.error_code == 4440004){
			// 			uni.showToast({
			// 				title:res.message,
			// 				icon:"none"
			// 			})
			// 			setTimeout(()=>{
			// 				uni.navigateBack({
			// 					delta:1
			// 				})
			// 			},1500)
			// 		}
			// 		// this.address=res.datas.address
			// 		// this.express_name=res.datas.express_name
			// 		// this.shipping_code=res.datas.shipping_code
			// 		// this.state=res.datas.order_info.order_state				
			// 		let arr=res.datas.deliver_info
			// 		for(let i=0;i<arr.length;i++){
			// 			this.dataLis.push(arr[i])
			// 		}
					
			// 	})
			// },
			
		}
	}
</script>

<style>
	uni-page-body{
		background-color: #FFFFFF;
	}
	.ckwl .yesicon{
		width:52upx !important;
		height:52upx !important;
		
	}
	.ckwl .zhuants{
		margin:0 20upx;
		text-align: center;
		line-height: 33upx;
		padding:10upx;
		font-size:24upx;
		width:33upx;
		height:33upx;
		color:#fff;
		background-color: #ff4300;
		border-radius: 50%;
		position: relative;
	}
	.ckwl .diz{
		width:60%;
	}
	.ckwl .wuliu{
		padding-top:44upx;
		padding-bottom:44upx;
		min-height:100vh;
	}
	.ckwl .shlist .zhuant{
		margin:0 20upx;
		text-align: center;
		line-height: 33upx;
		padding:10upx;
		font-size:16upx;
		width:33upx;
		height:33upx;
		color:#fff;
		background-color: #999999;
		border-radius: 50%;
		position: relative;
	}
	.ckwl .shlist .zhuant1{
		margin:0 20upx;
		/* padding:10upx; */
		position: relative;
		width:52upx; 
		height:52upx;
		line-height: 52upx;
		text-align: center;
	}
	.ckwl .shlist .zhuant1 image{
		width:10upx;
		height:10upx;
	}
	
	.ckwl .shlist .zhuant1::before{
		content:'';
		 position: absolute;         /*定位背景横线的位置*/
		bottom: -80upx;
		left: 24upx;
		background-color: #eeeeee;
		width: 5upx;
		height: 80upx;
	}
	.ckwl .shlist .zhuant::before{
		content:'';
		 position: absolute;         /*定位背景横线的位置*/
		bottom: -80upx;
		left: 24upx;
		border:1upx dashed #999;
		width: 5upx;
		height: 80upx;
	}
	.ckwl .shlist .zhuants::before{
		content:'';
		 position: absolute;         /*定位背景横线的位置*/
		bottom: -80upx;
		left: 24upx;
		border:1upx dashed #ff4300;
		width: 5upx;
		height: 80upx;
	}
	.ckwl .shlist{
		padding-bottom:46upx;
	}
	.ckwl .times{
		width:140upx;
		text-align: center;
	}
</style>
